//case1
class Parent
{
public:
    void print(Parent p)
    {
        cout << "a = " << p.a << endl; //Yes
    }
private:
    int a = 1;
    int b = 2;
};
class Child
{
public:
private:
    int c = 1;
};


//case2
class Parent
{
public:
    void print(Child child)
    {
        cout << "a = " << child.c << endl; //Error
    }
private:
    int a = 1;
    int b = 2;
};
class Child
{
public:
private:
    int c = 1;
};


//update
class Ci
{
public:
	Ci(int _a,int _b)
		:a(_a),b(_b)
	{
		cout << "  kkk" << endl;
	}
	Ci(const Ci& c)
	{

	}
	Ci& operator=(const Ci& c)
	{
		return *this;
	}

	static Ci& get()
	{
		return c1;
	}
	~Ci()
	{
		cout << "~Ci()";
	}
	static Ci c1; //进入main函数之前已经初始化了
	int a;
	int b;
};
Ci Ci::c1(1,2);

static Ci c2(2, 3);//进入main函数之前已经初始化了

Ci GetCi(Ci& c)
{
	static Ci c2(6, 7); //执行这条代码的时候才进行初始化
	Ci c1(5, 6);
	c = c1;
	return c1;
}

int main()
{
	int i = 0;
	int cnt = 2;
	while (cnt--)
	{
	}
	if (cnt) {  // cnt此时等于-1
		//...
	}
	Ci c2(0, 0);
	const Ci& cc = GetCi(c2);
	for (int i = 0;i < 2;++i)
	{
		Ci c(8, 9); //每循环一次都会析构
	}
    return 0;
}